const Koa = require('koa')
const app = new Koa()
const router = require('koa-router')()
const response_formatter = require('../middlewares/');
import banner from './banner'

//添加格式化处理响应结果的中间件，在添加路由之前调用
//仅对/api开头的url进行格式化处理
app.use(response_formatter('^/api'));

const users = require('./users');
// const banner = require('./banner');

// routes表示的是路由的嵌套处理
router.use('/api', users.routes(), users.allowedMethods())
router.use('/api', banner.routes(), banner.allowedMethods())

module.exports = router
